package com.ruoyi.trainingManagement.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.trainingManagement.domain.Vo.StudentScoreListVo;
import com.ruoyi.trainingManagement.domain.Vo.StudentScoreStatsVO;
import com.ruoyi.trainingManagement.service.StudentScoreService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/trainingManagement/studentScore")
public class StudentScoreController {

    @Resource
    private StudentScoreService studentScoreService;

    @GetMapping("/list")
    public R getScoreList(@RequestParam String userName) {
        List<StudentScoreListVo> scores = studentScoreService.getScoreList(userName);
        return R.ok().put("data", scores);
    }

    @GetMapping("/stats")
    public R getScoreStats(@RequestParam String userName) {
        StudentScoreStatsVO stats = studentScoreService.getScoreStats(userName);
        return R.ok().put("data", stats);
    }
}